@php

 $user=  \App\User::select(DB::raw('sum(distribution_money) as distri'),DB::raw('sum(distribution_used_money) as distri_used'),DB::raw('sum(team_money) as team'),DB::raw('sum(team_used_money) as team_used'))->first();
$list=json_encode([
    $user->distri+$user->team,
    $user->distri,
    $user->team,
    $user->distri_use+$user->team_used,
    $user->ditri_used,
    $user->team_used,
]);
@endphp

<div id="userMoney" style="width: 1200px;height:400px;"></div>
<script>

    $(function () {

        var data ={!!$list !!};


        var myChart1 = echarts.init(document.getElementById('userMoney'));
        var option = {
            title: {
                text: '用户收益统计'

            },
            tooltip: {},
            legend: {
                data: ['金额']
            },
            xAxis: {
                data: ["总收益","推广收益","团队收益", "已结算收益", '已结算推广收益','已结算团队收益']
            },
            yAxis: {},
            series: [{
                name: '收益',
                type: 'bar',
                data: data
            }],
            color:['#3c8dbc']
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart1.setOption(option);
    })
</script>